const Sequelize = require('sequelize')
const sequelize = require('../config/index')
const User = require('./user').User
let Company_verify = sequelize.define('company_verify',{
    id:{
        type:Sequelize.INTEGER,
        primaryKey: true,
        autoIncrement: true,
        comment:'主键id',
    },
    license_name:{
        type:Sequelize.STRING,
        comment:'营业执照名称',
    },
    license_no:{
        type:Sequelize.STRING,
        comment:'营业执照编号',
    },
    phone:{
        type:Sequelize.STRING,
        comment:'电话'
    },
    address:{
        type:Sequelize.TEXT,
        comment:'地址',
    },
    address_detail:{
        type:Sequelize.STRING,
        comment:'详细地址',
    },
    image:{
        type:Sequelize.TEXT,
        comment:'营业执照图片',
    },
    isDel:{
        type:Sequelize.INTEGER,
        defaultValue:0,
        comment:'是否删除'
    }

},{
    // freezeTabelName 为 true 时不会在库中映射表时增加复数表名
    // 该选项为 true 时，user 在映射时映射成 user，而为 false 时会映射成users
    freezeTableName: true,
})
Company_verify.belongsTo(User,{foreignKey: "uid"});
// Skill.belongsToMany(User, {through : 'userSkill'});
//这会创建一个新模型UserProject,其中projectId和userId两个外键。定义through选项后，Sequelize会尝试自动生成名字。
//在本例中，会为User添加方法getUsers,setUsers,addUser,addUsers到Project中。getProjects,setProjects,addProject,addProjects到User中.


let company_verify = Company_verify.sync();

module.exports = Company_verify

